package edu.xaut.bookingsys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.xaut.bookingsys.entity.InfoCourse;
import edu.xaut.bookingsys.entity.InfoTeacher;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface InfoCourseMapper extends BaseMapper<InfoCourse> {
//    /**
//     * 使用mybatise的方式，也是可以的，但这种方式，其实也会调用两次sql，并不会减少调用次数
//     * 所以说使用mybatise-plus的方式，将逻辑全部在service层处理，可以省去大量的sql编写
//     * @return
//     */
//    @Select("SELECT * FROM bookData.InfoCourse")
//@Results(
//        {
////                @Result(column = "courseId",property = "courseId"),
////                @Result(column = "courseName",property = "courseName"),
////                @Result(column = "classNumber",property = "isTask"),
////                @Result(column = "courseType",property = "isTask"),
////                @Result(column = "isTask",property = "isTask"),
////                @Result(column = "environmentNeed",property = "environmentNeed"),
////                @Result(column = "teacherId",property = "teacherId"),
//                @Result(
//                        javaType = InfoTeacher.class,
//                        property = "infoTeacher",
//                        column = "teacherId",
//                        one=@One(select = "edu.xaut.bookingsys.mapper.InfoTeacherMapper.selectById")
//                )
//        }
//)
//    public List<InfoCourse> selectAll();
//@Select("SELECT * FROM bookData.InfoTeacher WHERE teacherId=#tid")
//@Results(
//        @Result(
//                javaType = InfoTeacher.class,
//                property = "InfoTeacher",
//                column="teacherId",
//                one=@One(select = "edu.xaut.bookingsys.mapper.InfoTeacherMapper.selectById")
//        )
//)
//    List<InfoCourse> selectByTid(@Param("tid") int tid);
}
